#ifndef CNC_COMPILER_PROGRAM_DATABASE_H
#define CNC_COMPILER_PROGRAM_DATABASE_H

#include "progdb_.h"
// provided interface
	// #include "progmgr.h"
// basic component model
#include <bcm/bcm.h>

namespace cnc {

	namespace compiler {

		class ProgramDatabase : public bcm::Identifier<bcm::Component>,
			public ProgramDatabaseImpl
		{
		protected:
			ProgramDatabase() : bcm::Identifier<bcm::Component>("progdb", "Program Database")
			{
			}
		protected: // bcm::Component
			virtual bcm::IdentifierData *getProvidedInterfaceTable()
			{
				static bcm::IdentifierData idData[] = {
					{ "progmgr", "Program Manager" },
					{ 0, 0 }
				};
				return idData;
			}
			virtual bcm::IdentifierData *getRequiredInterfaceTable()
			{
				static bcm::IdentifierData idData[] = {
					{ 0, 0 }
				};
				return idData;
			}
			virtual bcm::Interface *getInterface(const char *id)
			{
				if (std::string("progmgr") == id)
					return static_cast<ProgramManager *>(this);
				return 0;
			}
			virtual bool setInterface(Interface *iface)
			{
				if (iface == 0)
					return false;
				else
					return false;
				return true;
			}
		public:
			static ProgramDatabase &instance()
			{
				static ProgramDatabase object;
				return object;
			}
		};

	} // namespace base

} // namespace cnc

#endif

